home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DIRS.SWG / 0008_DIREXIST.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  763b  |  31 lines

  1. {
  2.   re: Finding a directory
  3.  
  4. >Obviously that's not the quickest routine in the world, and though
  5. >it works, I was wondering if you have anything easier/faster?
  6.  
  7.   ...I don't know how much better this routine is, but you may
  8.   want to give it a try:
  9. }
  10.  
  11. { Determine if a directory exists. }
  12.  
  13. Function DirExist(st_Dir : DirStr) : Boolean;
  14. Var
  15.   wo_Fattr : Word;
  16.   fi_Temp  : File;
  17. begin
  18.   assign(fi_Temp, (st_Dir + '.'));
  19.   getfattr(fi_Temp, wo_Fattr);
  20.   if (Doserror <> 0) then
  21.     DirExist := False
  22.   else
  23.     DirExist := ((wo_Fattr and directory) <> 0)
  24. end; { DirExist. }
  25.  
  26. {
  27. notE: The "DirStr" Type definition is found in the standard TP
  28.       Dos Unit. Add this Unit to your Program's "Uses" statement
  29.       to use this routine.
  30. }
  31.